package com.dc.project.entity.dto;

import com.dc.project.entity.bo.TaskBo;
import com.own.component.common.base.entity.BaseDto;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * TaskDto
 *
 * @author chenxueli
 * @date 2025-03-08 15:11:52
 */
@Schema(title = "任务" + ConstantBeanSuffix.DTO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class TaskDto extends BaseDto<TaskBo> implements Serializable {

    @Schema(title = "企业名称")
    private String companyName;

    @Schema(title = "任务标题")
    private String title;

    @Schema(title = "任务状态")
    private Integer status;

    @Schema(title = "任务类型 1=根据自定义文件创建 2=根据模板生成")
    private Integer type;

    @Schema(title = "模板key")
    private String templateKey;

    @Schema(title = "是否热门 1=是 2=否")
    private Integer isHot;

    @Schema(title = "领域名称")
    private String realmName;

    @Schema(title = "是否是加密数据 1=是 0=不是")
    private Integer isEncrypt;

    @Schema(title = "访问密码")
    private String password;

    @Schema(title = "任务提示词")
    private String prompt;

    /**
     * 转业务层对象
     *
     * @param entity 原业务层对象
     * @return 业务层对象
     */
    @Override
    public TaskBo toBo(TaskBo entity) {
        if (entity == null) {
            entity = new TaskBo();
        }
        entity.setCompanyName(this.companyName);
        entity.setTitle(this.title);
        entity.setStatus(this.status);
        entity.setType(this.type);
        entity.setTemplateKey(this.templateKey);
        entity.setIsHot(this.isHot);
        entity.setRealmName(this.realmName);
        entity.setIsEncrypt(this.isEncrypt);
        entity.setPassword(this.password);
        entity.setPrompt(this.prompt);
        return super.toBo(entity);
    }

}

